<!--
*@tj-repayment-plan
*@author lijiaqi
*@date 2023/12/21 9:04
-->
<template>
  <div class="">
    <div class="show_box" @click="showRepayment()">
      <span>查看</span>
    </div>
  </div>
</template>

<script>
export default {
  name: "tj-repayment-plan",
  props: {
    value: {
      type: Object,
      default: {}
    },
    allData: {
      type: Object,
      default: {}
    }
  },
  components: {},
  data() {
    return {}
  },
  computed: {},
  watch: {},
  created() {
  },
  mounted() {
  },
  methods: {
    showRepayment() {
      // 调用保存接口
      console.log("当前------", this.value)
      console.log("当前9999999999999999", this.allData)
      //判断借款金额 REPAY_SCHEDULE
      if (this.value['LOAN_AMT']) {
        this.saveData()
      } else {
        this.$toast({
          icon: 'warning',
          message: '请输入借款金额'
        });
      }
    },
    /**
     * 保存当前页面数据
     * @param
     */
    saveData() {
      this.$toast.loading({
        duration: 0, // 持续展示 toast
        forbidClick: true,
        message: '加载中...'
      });
      let param = {
        action: 'save',
        data: this.allData,
        extendConf: {},
        instanceId: this.value.INST_ID,
        nodeId: "",
        taskId: this.$route.query.taskId,
      }
      console.log("当前-----------", param)
      this.baseService.post(this.__ctx + '/bpm/task/doAction', param).then(res => {
        this.$toast.clear();
        if (res.isOk) {
          //如果又返回taskid
          this.$router.push({
            path: '/loanPage/jkRepaymentPlan',
            query: {
              repaymentData: JSON.stringify(this.value)
            }
          })
        } else {
          this.$toast({
            icon: 'warning',
            message: res.msg
          });
        }
      }, function (status) {
        this.$toast.clear();
        if (status == !0) {
          this.$toast({
            icon: 'warning',
            message: '加载失败！' + status
          });
        }
      });
    },
  }
}
</script>

<style lang="less" scoped>
.show_box {
  color: rgb(22, 93, 255);
  font-family: HarmonyOS Sans SC;
  font-size: 16px;
  font-weight: 400;
  line-height: 18px;
  //letter-spacing: 0px;
  //text-align: left;
}
</style>
